﻿<%@ Page Language="C#" MasterPageFile="~/Game/Game.Master" AutoEventWireup="true"
    CodeBehind="Planet.aspx.cs" Inherits="smallDeimos.Game.Planet" Title="Small Deimos - Planet view" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript" src="../jqModal.js"></script>

    <script type="text/javascript" language="javascript">
$().ready(function() {
var pidt = document.getElementById("<%= HiddenField1.ClientID %>");
var sidt = document.getElementById("<%= HiddenField2.ClientID %>");
var myClose = function(hash) { window.location.reload() };
  $('#farm').jqm({ajax: 'Controls/BuildBox.aspx?Build=Farm&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.farmtrigger', onHide: myClose});
  $('#Factory').jqm({ajax: 'Controls/BuildBox.aspx?Build=Factory&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.Factorytrigger', onHide:myClose});
  $('#Cybernet').jqm({ajax: 'Controls/BuildBox.aspx?Build=Cybernet&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.cybernettrigger', onHide:myClose});
  $('#Lab').jqm({ajax: 'Controls/BuildBox.aspx?Build=Lab&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.labtrigger', onHide:myClose});
  $('#SB').jqm({ajax: 'Controls/BuildBox.aspx?Build=Starbase&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.SBtrigger', onHide:myClose});
  
    $('#CS').jqm({ajax: 'Controls/BuildBox.aspx?Build=CS&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.cstrigger', onHide: myClose});
  $('#TR').jqm({ajax: 'Controls/BuildBox.aspx?Build=TR&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.trtrigger', onHide:myClose});
  $('#DS').jqm({ajax: 'Controls/BuildBox.aspx?Build=DS&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.dstrigger', onHide:myClose});
  $('#CR').jqm({ajax: 'Controls/BuildBox.aspx?Build=CR&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.crtrigger', onHide:myClose});
  $('#BS').jqm({ajax: 'Controls/BuildBox.aspx?Build=BS&SId=' + sidt.value + '&PId=' + pidt.value, trigger: 'a.bstrigger', onHide:myClose});
});
    </script>

    <style type="text/css">
        /* jqModal base Styling courtesy of;
  Brice Burgess <bhb@iceburg.net> *//* The Window's CSS z-index value is respected (takes priority). If none is supplied,
  the Window's z-index value will be set to 3000 by default (in jqModal.js). You
  can change this value by either;
    a) supplying one via CSS
    b) passing the "zIndex" parameter. E.g.  (window).jqm({zIndex: 500}); */.jqmWindow
        {
            display: none;
            position: fixed;
            top: 17%;
            left: 50%;
            margin-left: -300px;
            width: 400px;
            background-color: Black;
            color: #C0C0C0;
            border: 1px solid black;
            padding: 12px;
        }
        .jqmOverlay
        {
            background-color: #000;
        }
        /* Fixed posistioning emulation for IE6
     Star selector used to hide definition from browsers other than IE6
     For valid CSS, use a conditional include instead */* html .jqmWindow
        {
            position: absolute;
            top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) +    'px' );
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="HiddenField1" runat="server" />
    <asp:HiddenField ID="HiddenField2" runat="server" />
    Go to planet:<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
        AutoPostBack="True">
    </asp:DropDownList>
    <br />
    <asp:Label ID="Label11" runat="server" Text=""></asp:Label>
    <asp:DataList ID="DataList1" runat="server" DataKeyField="PlanetID" DataSourceID="SqlDataSource1"
        Width="780px" Style="margin-right: 0px">
        <ItemTemplate>
            PopulationLevel:
            <asp:Label ID="PopulationLevelLabel" runat="server" Text='<%# Eval("PopulationLevel") %>' />
            PopToNextLevel:
            <asp:Label ID="PopToNextLevelLabel" runat="server" Text='<%# Eval("PopToNextLevel", "{0:F3}") %>' />
            <asp:Label ID="TimeLabel" runat="server" Text='<%# CalcPop(Eval("Farms"))%>' />
            <br />
            ProductionPoints:
            <asp:Label ID="ProductionPointsLabel" runat="server" Text='<%# Eval("ProductionPoints", "{0:F3}") %>' />
            <br />
            <table border="1">
                <tr>
                    <th colspan="6">
                        <asp:Label ID="SystemIDLabel" runat="server" Text='<%# Eval("SystemName") %>' Font-Bold="True"
                            Font-Size="Larger" />
                        <asp:Label ID="PlanetIDLabel" runat="server" Text='<%# Eval("PlanetID") %>' Font-Bold="True"
                            Font-Size="Larger" />
                    </th>
                </tr>
                <tr>
                    <th colspan="3">
                        Buldings
                    </th>
                    <th colspan="3">
                        Ships
                    </th>
                </tr>
                <tr>
                    <td>
                        Farms
                    </td>
                    <td>
                        <asp:Label ID="Label12" runat="server" Text='<%# Eval("Farms") %>' />
                        <asp:Label ID="Label1" runat="server" Text='<%# BuldingCost(Eval("Farms")) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="+1" />
                        <asp:Button ID="Button24" runat="server" Text="+Max" OnClick="Button24_Click" />
                        <asp:Button ID="Button28" runat="server" Text="Use SU" OnClick="Button28_Click" />
                        <a href="#" class="farmtrigger">...
                            <div class="jqmWindow" id="farm">
                                Please wait...
                            </div>
                    </td>
                    <td>
                        ColonyShips
                    </td>
                    <td>
                        <asp:Label ID="Label13" runat="server" Text='<%# Eval("ColonyShips") %>' />
                        <asp:Label ID="Label6" runat="server" Text='<%# ShipCost(1) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button6" runat="server" Text="+1" OnClick="Button6_Click" />
                        <asp:Button ID="Button7" runat="server" Text="+10" OnClick="Button7_Click" />
                        <asp:Button ID="Button8" runat="server" Text="+50" OnClick="Button8_Click" />
                        <a href="#" class="cstrigger">...
                            <div class="jqmWindow" id="CS">
                                Please wait...
                            </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Factories
                    </td>
                    <td>
                        <asp:Label ID="Label14" runat="server" Text='<%# Eval("Factories") %>' />
                        <asp:Label ID="Label2" runat="server" Text='<%# BuldingCost(Eval("Factories")) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button2" runat="server" Style="height: 26px" Text="+1" OnClick="Button2_Click" />
                        <asp:Button ID="Button25" runat="server" Text="+Max" OnClick="Button25_Click" /><asp:Button
                            ID="Button29" runat="server" Text="Use SU" OnClick="Button29_Click" Style="height: 26px" />
                        <a href="#" class="Factorytrigger">...
                            <div class="jqmWindow" id="Factory">
                                Please wait...
                            </div>
                    </td>
                    <td>
                        Transports
                    </td>
                    <td>
                        <asp:Label ID="Label15" runat="server" Text='<%# Eval("Transports") %>' />
                        <asp:Label ID="Label7" runat="server" Text='<%# ShipCost(2) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button9" runat="server" Text="+1" OnClick="Button9_Click" />
                        <asp:Button ID="Button10" runat="server" Text="+10" OnClick="Button10_Click" />
                        <asp:Button ID="Button11" runat="server" Text="+50" OnClick="Button11_Click" />
                        <a href="#" class="trtrigger">...
                            <div class="jqmWindow" id="TR">
                                Please wait...
                            </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Cybernets
                    </td>
                    <td>
                        <asp:Label ID="Label16" runat="server" Text='<%# Eval("Cybernets") %>' />
                        <asp:Label ID="Label3" runat="server" Text='<%# BuldingCost(Eval("Cybernets")) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button3" runat="server" Style="height: 26px" Text="+1" OnClick="Button3_Click" />
                        <asp:Button ID="Button26" runat="server" Text="+Max" OnClick="Button26_Click" />
                        <asp:Button ID="Button30" runat="server" Text="Use SU" OnClick="Button30_Click" />
                        <a href="#" class="cybernettrigger">...
                            <div class="jqmWindow" id="Cybernet">
                                Please wait...
                            </div>
                    </td>
                    <td>
                        Destroyers
                    </td>
                    <td>
                        <asp:Label ID="Label17" runat="server" Text='<%# Eval("Destroyers") %>' />
                        <asp:Label ID="Label8" runat="server" Text='<%# ShipCost(3) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button12" runat="server" Text="+1" OnClick="Button12_Click" />
                        <asp:Button ID="Button13" runat="server" Text="+10" OnClick="Button13_Click" />
                        <asp:Button ID="Button14" runat="server" Text="+100" OnClick="Button14_Click" />
                        <a href="#" class="dstrigger">...
                            <div class="jqmWindow" id="DS">
                                Please wait...
                            </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Labs
                    </td>
                    <td>
                        <asp:Label ID="Label18" runat="server" Text='<%# Eval("Labs") %>' />
                        <asp:Label ID="Label4" runat="server" Text='<%# BuldingCost(Eval("Labs")) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button4" runat="server" Style="height: 26px" Text="+1" OnClick="Button4_Click" />
                        <asp:Button ID="Button27" runat="server" Text="+Max" OnClick="Button27_Click" />
                        <asp:Button ID="Button31" runat="server" Text="Use SU" OnClick="Button31_Click" />
                        <a href="#" class="labtrigger">...
                            <div class="jqmWindow" id="Lab">
                                Please wait...
                            </div>
                    </td>
                    <td>
                        Crusiers
                    </td>
                    <td>
                        <asp:Label ID="Label19" runat="server" Text='<%# Eval("Crusiers") %>' />
                        <asp:Label ID="Label9" runat="server" Text='<%# ShipCost(4) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button16" runat="server" Text="+1" OnClick="Button16_Click" />
                        <asp:Button ID="Button17" runat="server" Text="+10" OnClick="Button17_Click" />
                        <asp:Button ID="Button18" runat="server" Text="+100" OnClick="Button18_Click" />
                        <a href="#" class="crtrigger">...
                            <div class="jqmWindow" id="CR">
                                Please wait...
                            </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Starbase
                    </td>
                    <td>
                        <asp:Label ID="Label20" runat="server" Text='<%# Eval("Starbase") %>' />
                        <asp:Label ID="Label5" runat="server" Text='<%# BuldingCost(Eval("Starbase")) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button5" runat="server" Style="height: 26px" Text="+1" OnClick="Button5_Click" />
                        <a href="#" class="SBtrigger">...
                            <div class="jqmWindow" id="SB">
                                Please wait...
                            </div>
                    </td>
                    <td>
                        Battleships
                    </td>
                    <td>
                        <asp:Label ID="Label21" runat="server" Text='<%# Eval("Battleships") %>' />
                        <asp:Label ID="Label10" runat="server" Text='<%# ShipCost(5) %>' />
                    </td>
                    <td>
                        <asp:Button ID="Button20" runat="server" Text="+1" OnClick="Button20_Click" />
                        <asp:Button ID="Button21" runat="server" Text="+10" OnClick="Button21_Click" />
                        <asp:Button ID="Button22" runat="server" Text="+100" OnClick="Button22_Click" />
                        <a href="#" class="bstrigger">...
                            <div class="jqmWindow" id="BS">
                                Please wait...
                            </div>
                    </td>
                </tr>
            </table>
            <%-- PlanetID:
            
            <br />
            SystemID:
            
            <br />
            OwnerID:
            <asp:Label ID="OwnerIDLabel" runat="server" Text='<%# Eval("OwnerID") %>' />
            <br />
            FleetOwnerID:
            <asp:Label ID="FleetOwnerIDLabel" runat="server" 
                Text='<%# Eval("FleetOwnerID") %>' />
            <br />--%>
            <%-- SystemName:
            <asp:Label ID="SystemNameLabel" runat="server" 
                Text='<%# Eval("SystemName") %>' />
            <br />--%>
            <br />
        </ItemTemplate>
    </asp:DataList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>"
        SelectCommand="SELECT Planets.PlanetID, Planets.SystemID, Planets.OwnerID, Planets.FleetOwnerID, Planets.ColonyShips, Planets.Transports, Planets.Destroyers, Planets.Crusiers, Planets.Battleships, Planets.Farms, Planets.Factories, Planets.Cybernets, Planets.Labs, Planets.Starbase, Planets.PopulationLevel, Planets.PopToNextLevel, Planets.ProductionPoints, Systems.SystemName FROM Planets INNER JOIN Systems ON Planets.SystemID = Systems.SystemID WHERE (Planets.PlanetID = @pId) AND (Planets.SystemID = @sId) AND (Planets.OwnerID = @oId)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="pId" QueryStringField="pId" Type="Int16" />
            <asp:QueryStringParameter DefaultValue="0" Name="sId" QueryStringField="sId" Type="Int16" />
            <asp:CookieParameter CookieName="sd_id" Name="oId" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
